package com.jstyle.jclifexd.activity;

import android.graphics.Typeface;
import android.os.Bundle;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.jstyle.jclifexd.R;
import com.jstyle.jclifexd.utils.ScreenUtils;
import com.jstyle.jclifexd.utils.Utils;

import butterknife.BindString;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * 心率以及血压等名词解释
 */
public class HeartTipsActivity extends BaseActivity {

    @BindView(R.id.tv_heart_tips)
    TextView tvHeartTips;
    @BindString(R.string.tips_pressure)
    String htmlTipsPressure;
    @BindString(R.string.tips_hrv)
    String htmlTipsHrv;
    @BindString(R.string.tips_heart)
    String htmlTipsHeart;
    @BindString(R.string.heart_range_tips)
    String htmlTipsActivityHeart;
    @BindString(R.string.tips_bmi)
    String htmlTipsBMI;
    @BindString(R.string.sleep_heart)
    String htmlTipsSleepHeart;
    @BindString(R.string.ecg_tips)
    String htmlTipsEcg;
    @BindString(R.string.tips_bp)
    String htmlTipsBp;
    @BindView(R.id.bt_goal_back)
    Button btGoalBack;
    @BindView(R.id.iv_back)
    ImageView ivBack;
    @BindView(R.id.iv_share)
    ImageView ivShare;
    public final  static String TipsType="TipsType";
    public final  static int TipsType_Heart=0;
    public final  static int TipsType_HRV=1;
    public final  static int TipsType_BLOOD=2;
    public final  static int TipsType_Stress=3;
    public final  static int TipsType_ActivityHeart=4;
    public final  static int TipsType_SleepHeart=5;
    public final  static int TipsType_BMI=6;
    public final  static int TipsType_ECG=7;
    public final  static int TipsType_Service=8;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_heart_tips);
        ButterKnife.bind(this);

       setTipsString(getIntent().getIntExtra(TipsType,TipsType_Heart));


        ivShare.setVisibility(View.GONE);

    }
    private void setTipsString(int type){
        Typeface mFace ;
        if(!Utils.IsRussian(this)) {
            mFace = Typeface.createFromAsset(getAssets(), "ROBOTO-LIGHT_1.TTF");
        }else{
            mFace= Typeface.createFromAsset(getAssets(), "SourceHanSansCN-Regular.ttf");
        }

        String tips="";
        String title="";
        switch (type){
            case TipsType_SleepHeart:
                tips=htmlTipsSleepHeart;
                title=getString(R.string.sleep_hr);
                break;
            case TipsType_ActivityHeart:
                tips=htmlTipsActivityHeart;
                title=getString(R.string.activity_hr);
                break;
            case TipsType_BLOOD:
                tips=htmlTipsBp;
                title=getString(R.string.bp);
                break;
            case TipsType_Heart:
                tips=htmlTipsHeart;
                title=getString(R.string.hr);
                break;
            case TipsType_HRV:
                tips=htmlTipsHrv;
                title=getString(R.string.hrv);
                break;
            case TipsType_Stress:
                tips=htmlTipsPressure;
                title=getString(R.string.stress);
                break;
            case TipsType_BMI:
                tips=htmlTipsBMI;
                title=getString(R.string.bmi);
                break;
            case TipsType_ECG:
                tips=htmlTipsEcg;
                title="ECG";
                break;
            case TipsType_Service:
                tips=getResources().getString(R.string.service);
                title="用户服务协议";
                break;
        }
        btGoalBack.setText(title);
        ScreenUtils.setTitleTypeface(btGoalBack);
        tvHeartTips.setTypeface(mFace);
        tvHeartTips.setText(Html.fromHtml(tips));
        tvHeartTips.setMovementMethod(LinkMovementMethod.getInstance());
    }
    @OnClick(R.id.iv_back)
    public void onViewClicked() {
        finish();
    }
}
